home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 2 / Gold Medal Software Volume 2 (Gold Medal) (1994).iso / prog / asm_n_z.arj / RES86B.ASM < prev    next >
Assembly Source File  |  1985-08-02  |  37KB  |  2,302 lines

  1.  
  2. ; Here is the second half of the RESOURCE program source
  3.  
  4.     page    60,132
  5.  
  6. code    segment    byte public
  7.  
  8.     assume    cs:code,ds:code
  9.  
  10.     extrn    start:near,hsym:near,nwln0:near,delim:near,cmerr:near
  11.     extrn    nxcmd:near
  12.  
  13.     extrn    fcb:word,tbuf:word
  14.  
  15.     public    stack,wfiflg,quiflg,segflg,trmflg,segsho,opdtyp,segmsk,insloc
  16.     public    ofsptr,curpar,segsiz,dmpstt,dmpcnt,dmpend,curofs,wrtflg
  17.     public    ascbld,liscnt,cntenb,lastwd,doctbl,pcntr,rplptr,ecnt,xcptr
  18.     public    nxtctl,symtp,docend,ctlbas,fndadd,fndpc,nrsegs,mcbsiz
  19.     public    cofset,sdflg,ctltop,typndx,xcsw,hiload,symtyp,mcbbas,fake_comtbl
  20.  
  21.     public    bdos,initbl,typech,gtcmd,cmdbuf,cmentr,flushf,prtstr,pstrg
  22.     public    cmkill,prword,gtval,pstg,typech,xo0,crlf,gtval,symbas,prntde
  23.     public    xo,addfn,keychk,cofset,prspc,pstar,lngth,locsym,ifasci
  24.     public    semic,dline,dcrlf,adb,strcnt,litall,cmpstr,litcmd,litdoc
  25.     public    litctl,litsym,fopen,cstbl,segnam,fclose,rdfchr,creatf
  26.     public    wtfchr,lita86,hexl,hexr,symluk,rdfchr,semic,tabc
  27.  
  28. ;
  29. ;
  30. ;
  31. dline:    cmp    nlblfg,0
  32.     jnz    l11b9
  33.     cmp    segval,0
  34.     jz    l11b6
  35.     cmp    pfxcnt,0
  36.     jnz    l11b6
  37.     mov    segval,0    ;clr segval
  38.     call    pstg
  39.     db    0ah,0dh,';ILLEGAL SEGMENT OVERRIDE '
  40.     db    'ATTEMPTED !',0ah,0dh,0
  41. l11b6:    mov    al,segmsk
  42.     mov    opdtyp,al
  43.     call    hsym
  44.     mov    bx,rplptr
  45.     mov    al,bh
  46.     or    al,bl
  47.     jz    l11b9
  48.     mov    ch,byte ptr [bx]
  49.     inc    bx    ;skip the *
  50.     dec    ch
  51.     call    nwln0    ;print replacing line with comment
  52.     mov    al,0ffh
  53.     mov    replsw,al
  54. l11b9:    dec    pfxcnt
  55.     mov    es,curpar
  56.     mov    nlblfg,0
  57.     mov    opdtyp,    04h    ;ds is most likely 
  58.     mov    pfflg,al
  59.     mov    dx,pcntr
  60.     mov    bx,curofs
  61.     add    bx,dx
  62.     mov    curadr,bx
  63.     inc    dx
  64.     mov    pcntr,dx
  65.     mov    ch,es:byte ptr [bx]    ;opcode byte in ch
  66.     mov    cinstr,ch
  67.     mov    bx,offset opct-7
  68.     mov    dx,7    ;size of table item -1
  69. l11e3:    add    bx,dx
  70.     mov    al,cs:byte ptr [bx]
  71.     or    al,al
  72.     jnz    l11ee
  73.     jmp    pdbbyt    ;end of table
  74. ;
  75. l11ee:    and    al,ch
  76.     mov    cl,al    ;masked opcode
  77.     inc    bx
  78.     mov    al,cs:byte ptr [bx]
  79.     cmp    al,cl    ;test against pattern
  80.     jnz    l11e3
  81.     inc    bx
  82.     mov    al,cs:byte ptr [bx]    ;instr type index
  83.     mov    byte ptr typndx,al
  84.     mov    ch,5    ;size of literal
  85. lopclp:    inc    bx
  86.     mov    al,cs:byte ptr [bx]
  87.     cmp    al,'.'    ;dot to be ignored
  88.     jz    nodot
  89.     call    typech    ;output literal opcode
  90. nodot:    dec    ch
  91.     jnz    lopclp
  92.     mov    dl,byte ptr typndx
  93.     and    dl,3fh
  94.     mov    dh,0
  95.     mov    bx,offset jmptbl
  96.     add    bx,dx
  97.     add    bx,dx
  98.     mov    dx,cs:[bx]
  99.     mov    bx,curadr
  100.     jmp    dx
  101. ;
  102. ;
  103. jmptbl    dw    offset kind00
  104.     dw    offset kind01
  105.     dw    offset kind02
  106.     dw    offset kind03
  107.     dw    offset kind04
  108.     dw    offset kind05
  109.     dw    offset kind06
  110.     dw    offset kind07
  111.     dw    offset kind08
  112.     dw    offset kind09
  113.     dw    offset kind10
  114.     dw    offset kind11
  115.     dw    offset kind12
  116.     dw    offset kind13
  117.     dw    offset kind14
  118.     dw    offset kind15
  119.     dw    offset kind16
  120.     dw    offset kind17
  121.     dw    offset kind18
  122.     dw    offset kind19
  123.     dw    offset kind20
  124.     dw    offset kind21
  125.     dw    offset kind22
  126.     dw    offset kind23
  127.     dw    offset kind24
  128.     dw    offset kind25
  129.     dw    offset kind26
  130.     dw    offset kind27
  131.     dw    offset kind28
  132.     dw    offset kind29
  133.     dw    offset kind30
  134.     dw    offset kind31
  135.     dw    offset kind32
  136.     dw    offset kind33
  137.     dw    offset kind34
  138.     dw    offset kind35
  139.     dw    offset kind36
  140.     dw    offset kind37
  141.     dw    offset kind38
  142.     dw    offset kind39
  143. ;
  144. ;
  145. ;
  146. kind00:    jmp    dcrlf    ;opcode only
  147. ;
  148. kind01:    call    tabc        ;in/out
  149.     mov    al,es:[bx]
  150.     test    al,2
  151.     jnz    k01out
  152.     test    al,1
  153.     jnz    k01iw
  154.     call    pstg
  155.     db    'AL,DX',0
  156.     jmp    dcrlf
  157. ;
  158. k01iw:    call    pstg
  159.     db    'AX,DX',0
  160.     jmp    dcrlf
  161. ;
  162. k01out:    test    al,1
  163.     jnz    k01ow
  164.     call    pstg
  165.     db    'DX,AL',0
  166.     jmp    dcrlf
  167. ;
  168. k01ow:    call    pstg
  169.     db    'DX,AX',0
  170.     jmp    dcrlf
  171. ;
  172. kind02:    inc    pcntr
  173.     call    tabc
  174.     mov    al,es:[bx]
  175.     test    al,2
  176.     jnz    k02mtr
  177.     call    pstg
  178.     db    'AX,',0
  179.     jmp    l139b
  180. ;
  181. k02mtr:    inc    curadr
  182.     mov    bx,curadr
  183.     mov    al,es:[bx]
  184.     call    psmnum
  185.     call    pstg
  186.     db    ',AX',0
  187.     jmp    dcrlf
  188. ;
  189. kind37:    inc    pcntr
  190.     call    tabc
  191.     inc    bx
  192.     mov    al,es:[bx]
  193.     test    al,2
  194.     jnz    k37mtr
  195.     call    pstg
  196.     db    'AL,',0
  197.     jmp    l139b
  198. ;
  199. k37mtr:    inc    curadr
  200.     mov    bx,curadr
  201.     mov    al,es:[bx]
  202.     call    psmnum
  203.     call    pstg
  204.     db    ',AL',0
  205.     jmp    dcrlf
  206. ;
  207. kind03:    call    tabc
  208.     mov    al,es:[bx]
  209.     test    al,8
  210.     jnz    k03mtr
  211.     inc    pcntr
  212.     and    al,7
  213.     call    namrg8
  214.     call    comma
  215.     jmp    l139b
  216. ;
  217. k03mtr:    inc    pcntr
  218.     inc    pcntr
  219.     and    al,7
  220.     call    namr16
  221.     call    comma
  222. pwdval:                ;print word value
  223.     mov    bx,curadr
  224.     inc    bx
  225.     mov    dx,es:[bx]
  226.     push    dx
  227.     call    symluk
  228.     jnb    hvsym3
  229.     test    word ptr sybflg,0ffh
  230.     jz    nosym3
  231.     pop    dx
  232.     push    dx
  233.     call    addsym
  234. nosym3:    pop    dx
  235.     call    pcon16
  236.     jmp    dcrlf
  237. ;
  238. hvsym3:    call    pstg
  239.     db    'OFFSET ',0
  240.     call    pstrg
  241.     pop    dx
  242.     jmp    dcrlf
  243. ;
  244. kind04:    inc    pcntr        ;8 bit arith
  245.     call    tabc
  246.     call    pstg
  247.     db    'AL,',0
  248. l139b:    inc    curadr
  249.     call    bytopd
  250.     jmp    dcrlf
  251. ;
  252. bytopd:    mov    bx,curadr
  253.     mov    al,es:[bx]
  254.     cmp    al,' '
  255.     jb    l13c3
  256.     cmp    al,'Z'+1
  257.     jnb    l13c3
  258.     mov    al,es:[bx]
  259.     call    pqtchr
  260.     mov    al,''''    ;27h
  261.     call    typech    ;ending quote
  262.     call    tabc
  263.     call    semic
  264. l13c3:    mov    al,es:[bx]
  265.     call    psmnum
  266.     ret
  267. ;
  268. kind05:    call    tabc    ;call/jmp relative address
  269.     inc    pcntr
  270.     inc    pcntr
  271.     inc    bx
  272.     mov    dx,es:[bx]
  273.     inc    bx
  274.     inc    bx
  275.     sub    bx,curofs
  276.     add    bx,dx
  277.     mov    dx,bx
  278.     mov    opdtyp,0ch    ;cs, instruction
  279.     call    prntde
  280.     jmp    dcrlf
  281. ;
  282. kind06:    call    tabc
  283.     inc    pcntr
  284.     inc    pcntr
  285.     call    pstg
  286.     db    'AX,',0
  287.     jmp    pwdval
  288. ;
  289. opdsy1:    push    dx
  290.     call    symluk        ;check for symbol
  291.     jnb    havsym
  292.     jmp    short mkopds
  293. ;
  294. havsym:    call    pstrg        ;display operand symbol
  295.     pop    dx
  296.     ret
  297. ;
  298. prtdei:    mov    bx,curadr
  299.     inc    bx
  300.     mov    dx,es:[bx]
  301. prntde:    push    dx
  302.     call    symluk        ;test for symbol
  303.     jnb    hvsym2
  304. mkopds:    test    byte ptr sybflg,0ffh    ;building symbols?
  305.     jz    pmaddr
  306.     pop    dx
  307.     push    dx
  308.     call    addsym
  309.     jmp    pmaddr
  310. ;
  311. hvsym2:    call    pstrg
  312.     test    byte ptr trmflg,0ffh
  313.     jz    cmtadr
  314.     pop    dx
  315.     ret
  316. ;
  317. cmtadr:    call    tabc
  318.     call    semic
  319. pmaddr:    pop    dx
  320. pcon16:    mov    al,dh
  321.     or    al,dl
  322.     mov    al,'0'    ;30h
  323.     jz    l147d
  324.     mov    al,dh
  325.     or    al,al
  326.     jz    pcon8
  327.     call    xo0
  328.     mov    al,dl
  329.     call    xo
  330. phxsfx:    mov    al,'H'    ;48h
  331. l147d:    call    typech
  332.     ret
  333. ;
  334. pcon8:    mov    al,dl
  335. psmnum:    cmp    al,0ah
  336.     jb    padigt
  337.     call    xo0
  338.     jmp    phxsfx
  339. ;
  340. padigt:    add    al,'0'    ;30h
  341.     jmp    l147d
  342. ;
  343. kind07:    call    tabc
  344.     inc    pcntr
  345.     jmp    l139b
  346. ;
  347. kind08:    inc    pcntr
  348.     jmp    dcrlf
  349. ;
  350. kind09:    mov    al,' '    ;lock/rep/repnz
  351.     call    typech    ;space after prfx instr
  352.     mov    nlblfg,0ffh    ;no label betw opcodes
  353.     jmp    l11b9        ;really continue same instr
  354. ;
  355. kind10:    call    pstg        ;xlat opcode
  356.     db    9,'AL',0
  357.     jmp    dcrlf
  358. ;
  359. kind11:    call    pcndop        ;conditional jumps
  360. kind21:    call    tabc        ;jcxz/jmps
  361.     inc    pcntr
  362.     mov    bx,curadr
  363.     inc    bx
  364.     mov    al,es:[bx]
  365.     test    al,80h    ;what sign
  366.     jnz    k21neg
  367.     inc    bx
  368.     call    addfn
  369.     jmp    k21add
  370. ;
  371. k21neg:    inc    bx
  372.     not    al
  373.     inc    al
  374.     xor    ah,ah
  375.     sub    bx,ax
  376. k21add:    sub    bx,curofs
  377.     mov    dx,bx
  378.     mov    opdtyp,0ch    ;cs, instruction
  379.     call    prntde
  380.     jmp    dcrlf
  381. ;
  382. kind12:    call    tabc        ;movs/cmps
  383.     mov    al,es:[bx]
  384.     and    al,1
  385.     jnz    k12wrd
  386.     call    pstg
  387.     db    'AL,AL',0
  388.     jmp    dcrlf
  389. ;
  390. k12wrd:    call    pstg
  391.     db    'AX,AX',0
  392.     jmp    dcrlf
  393. ;
  394. kind13:    call    pstg        ;xchg ax with ??
  395.     db    9,'AX,',0
  396.     mov    al,es:[bx]
  397.     and    al,7
  398.     call    namr16
  399.     jmp    dcrlf
  400. ;
  401. kind14:    call    pstg        ;unimplemented opcodes
  402.     db    'DB',9,'0',0
  403.     mov    al,es:[bx]
  404.     call    xo
  405.     mov    al,'H'    ;48h
  406.     call    typech
  407.     jmp    dcrlf
  408. ;
  409. kind15:    call    tabc    ;one 16 bit register
  410.     mov    al,es:[bx]
  411.     and    al,7
  412.     call    namr16
  413.     jmp    dcrlf
  414. ;
  415. l1552:    mov    bx,curadr
  416.     inc    bx
  417.     mov    al,es:[bx]
  418.     and    al,7
  419.     jmp    l156d
  420. ;
  421. l155e:    mov    bx,curadr
  422.     inc    bx
  423.     mov    al,es:[bx]
  424.     and    al,38h
  425.     shr    al,1
  426.     shr    al,1
  427.     shr    al,1
  428. l156d:    push    ax
  429.     mov    bx,curadr
  430.     mov    al,es:[bx]
  431.     test    al,1
  432.     jnz    l157c
  433.     pop    ax
  434.     jmp    namrg8
  435. ;
  436. l157c:    pop    ax
  437.     jmp    namr16
  438. ;
  439. l1580:    mov    bx,curadr
  440.     inc    bx
  441.     mov    al,es:[bx]
  442.     and    al,0c0h
  443.     cmp    al,0
  444.     jz    l15ba
  445.     cmp    al,0c0h
  446.     jz    l1594
  447.     jmp    l15e0
  448. ;
  449. l1594:    inc    pcntr
  450.     mov    bx,curadr
  451.     mov    al,es:[bx]
  452.     test    al,2
  453.     jnz    l15ae
  454.     call    l1552
  455.     call    comma
  456.     call    l155e
  457.     jmp    dcrlf
  458. ;
  459. l15ae:    call    l155e
  460.     call    comma
  461.     call    l1552
  462.     jmp    dcrlf
  463. ;
  464. l15ba:    inc    pcntr
  465.     mov    bx,curadr
  466.     mov    al,es:[bx]
  467.     test    al,2
  468.     jnz    l15d4
  469.     call    l1606
  470.     call    comma
  471.     call    l155e
  472.     jmp    dcrlf
  473. ;
  474. l15d4:    call    l155e
  475.     call    comma
  476.     call    l1606
  477.     jmp    dcrlf
  478. ;
  479. l15e0:    inc    pcntr
  480.     mov    bx,curadr
  481.     mov    al,es:[bx]
  482.     test    al,2
  483.     jnz    l15fa
  484.     call    l164f
  485.     call    comma
  486.     call    l155e
  487.     jmp    dcrlf
  488. ;
  489. l15fa:    call    l155e
  490.     call    comma
  491.     call    l164f
  492.     jmp    dcrlf
  493. ;
  494. l1606:    call    psgprf        ;show segment first
  495.     mov    bx,curadr
  496.     mov    al,es:[bx]
  497.     test    al,1
  498.     jnz    l1623
  499.     call    pstg
  500.     db    'BYTE PTR ',0
  501.     or    byte ptr opdtyp,01h    ;byte size
  502.     jmp    l1630
  503. ;
  504. l1623:    call    pstg
  505.     db    'WORD PTR ',0
  506.     or    byte ptr opdtyp,02h    ;word size
  507. l1630:    call    pndxop
  508.     mov    bx,curadr
  509.     inc    bx
  510.     mov    al,es:[bx]
  511.     and    al,7
  512.     cmp    al,6
  513.     jnz    l164e
  514.     inc    pcntr
  515.     inc    pcntr
  516.     inc    bx
  517.     mov    dx,es:[bx]
  518.     call    opdsy1
  519. l164e:    ret
  520. ;
  521. l164f:    call    psgprf
  522.     mov    bx,curadr
  523.     mov    al,es:[bx]
  524.     test    al,1
  525.     jnz    l166c
  526.     call    pstg
  527.     db    'BYTE PTR ',0
  528.     or    byte ptr opdtyp,01h    ;byte size
  529.     jmp    l1679
  530. ;
  531. l166c:    call    pstg
  532.     db    'WORD PTR ',0
  533.     or    byte ptr opdtyp,02h    ;word size
  534. l1679:    inc    pcntr
  535.     mov    bx,curadr
  536.     inc    bx
  537.     mov    al,es:[bx]
  538.     inc    bx
  539.     test    al,80h
  540.     jnz    l1692
  541.     mov    al,es:[bx]
  542.     call    psmnum
  543.     call    pndxop
  544.     ret
  545. ;
  546. l1692:    inc    pcntr
  547.     mov    dx,es:[bx]
  548.     call    pcon16
  549.     call    pndxop
  550.     ret
  551. ;
  552. psgprf:    mov    al,segval
  553.     test    al,38h
  554.     jz    l16b7    ;no prefix
  555.     and    al,18h
  556.     call    psgpfx
  557.     call    colon
  558.     mov    al,segval
  559.     shr    al,1
  560.     and    al,0ch
  561.     xor    al,08h        ;invert b3 for better ascii
  562.     mov    opdtyp,al    ;segment info
  563.     mov    segval,0
  564.     call    prspc
  565.     ret
  566. ;
  567. l16b7:    ret
  568. ;
  569. namr16:    mov    bx,offset rtb16
  570.     add    al,al
  571.     call    addfn
  572.     mov    al,cs:[bx]
  573.     call    typech
  574.     inc    bx
  575.     mov    al,cs:[bx]
  576.     jmp    typech
  577. ;
  578. rtb16    db    'AX','CX','DX','BX','SP','BP','SI','DI'
  579. ;
  580. namrg8:    mov    bx,offset rtb08
  581.     add    al,al
  582.     call    addfn
  583.     mov    al,cs:[bx]
  584.     call    typech
  585.     inc    bx
  586.     mov    al,cs:[bx]
  587.     jmp    typech
  588. ;
  589. rtb08    db    'AL','CL','DL','BL','AH','CH','DH','BH'
  590. ;
  591. kind22:    call    tabc
  592.     mov    al,es:[bx]
  593.     and    al,1
  594.     jnz    k22wrd
  595.     call    pstg
  596.     db    'AL',0
  597.     jmp    dcrlf
  598. ;
  599. k22wrd:    call    pstg
  600.     db    'AX',0
  601.     jmp    dcrlf
  602. ;
  603. kind23:    mov    al,es:[bx]    ;segment ovrd prfx
  604.     and    al,38h
  605.     mov    segval,al
  606.     mov    nlblfg,0ffh
  607.     mov    pfxcnt,1
  608.     jmp    l11b9        ;to continue instr
  609. ;
  610. kind24:    call    tabc    ;push/pop seg regs
  611.     mov    al,es:[bx]
  612.     and    al,18h
  613.     call    psgpfx
  614.     jmp    dcrlf
  615. ;
  616. kind25:    call    tabc    ;mov reg <-> mem
  617.     inc    pcntr
  618.     inc    pcntr
  619.     mov    al,es:[bx]
  620.     test    al,2
  621.     jz    k25mtr        ;reg<-mem
  622.     call    pmemor
  623.     call    comma
  624.     call    paccum
  625.     jmp    dcrlf
  626. ;
  627. k25mtr:    call    paccum
  628.     call    comma
  629.     call    pmemor
  630.     jmp    dcrlf
  631. ;
  632. paccum:    mov    bx,curadr
  633.     mov    al,es:[bx]
  634.     test    al,1
  635.     jnz    acc16b
  636.     call    pstg
  637.     db    'AL',0
  638.     ret
  639. ;
  640. acc16b:    call    pstg
  641.     db    'AX',0
  642.     ret
  643. ;
  644. pmemor:    call    psgprf
  645.     mov    bx,curadr
  646.     mov    al,es:[bx]
  647.     test    al,1
  648.     jnz    l17a6
  649.     call    pstg
  650.     db    'BYTE PTR ',0
  651.     or    byte ptr opdtyp,01h    ;byte size
  652.     jmp    l17b3
  653. ;
  654. l17a6:    call    pstg
  655.     db    'WORD PTR ',0
  656.     or    byte ptr opdtyp,02h    ;word size
  657. l17b3:    mov    bx,curadr
  658.     inc    bx
  659.     mov    dx,es:[bx]
  660.     call    opdsy1
  661.     ret
  662. ;
  663. kind26:    inc    bx
  664.     mov    al,es:[bx]
  665.     and    al,38h
  666.     cmp    al,30h        ;stack seg?
  667.     jnz    l17ce
  668.     jmp    l1c16
  669. ;
  670. l17ce:    call    pshfop
  671.     call    tabc
  672.     call    l17f5
  673.     call    comma
  674.     mov    bx,curadr
  675.     mov    al,es:[bx]
  676.     and    al,2
  677.     jz    k26sh1
  678.     call    pstg
  679.     db    'CL',0        ;shift count in cl
  680.     jmp    dcrlf
  681. ;
  682. k26sh1:    mov    al,'1'    ;31h
  683.     call    typech
  684.     jmp    dcrlf
  685. ;
  686. l17f5:    inc    pcntr
  687.     mov    bx,curadr
  688.     inc    bx
  689.     mov    al,es:[bx]
  690.     and    al,0c0h
  691.     cmp    al,0c0h
  692.     jz    l180d
  693.     cmp    al,0
  694.     jz    l1815
  695.     jmp    l1811
  696. ;
  697. l180d:    call    l1552
  698.     ret
  699. ;
  700. l1811:    call    l164f
  701.     ret
  702. ;
  703. l1815:    call    l1606
  704.     ret
  705. ;
  706. kind27:    inc    bx
  707.     mov    al,es:[bx]
  708.     and    al,38h
  709.     jz    l1827
  710.     jmp    l1c16
  711. ;
  712. l1827:    call    pstg
  713.     db    'POP',0
  714.     call    tabc
  715.     call    l17f5
  716.     jmp    dcrlf
  717. ;
  718. kind28:    inc    bx
  719.     mov    al,es:[bx]
  720.     test    al,20h
  721.     jz    l1845
  722.     jmp    l1c16
  723. ;
  724. l1845:    call    pstg
  725.     db    'MOV',0
  726.     call    tabc
  727.     mov    bx,curadr
  728.     mov    al,es:[bx]
  729.     test    al,2
  730.     jnz    l1865
  731.     call    l187d
  732.     call    comma
  733.     call    l1871
  734.     jmp    dcrlf
  735. ;
  736. l1865:    call    l1871
  737.     call    comma
  738.     call    l187d
  739.     jmp    dcrlf
  740. ;
  741. l1871:    mov    bx,curadr
  742.     inc    bx
  743.     mov    al,es:[bx]
  744.     and    al,18h
  745.     jmp    psgpfx
  746. ;
  747. l187d:    inc    pcntr
  748.     mov    bx,curadr
  749.     inc    bx
  750.     mov    al,es:[bx]
  751.     and    al,0c0h
  752.     cmp    al,0c0h
  753.     jz    l1895
  754.     cmp    al,0
  755.     jz    l18a1
  756.     jmp    l18a4
  757. ;
  758. l1895:    mov    bx,curadr
  759.     inc    bx
  760.     mov    al,es:[bx]
  761.     and    al,7
  762.     jmp    namr16
  763. ;
  764. l18a1:    jmp    l18a7
  765. ;
  766. l18a4:    jmp    l18ba
  767. ;
  768. l18a7:    call    psgprf
  769.     call    pstg
  770.     db    'WORD PTR ',0
  771.     or    byte ptr opdtyp,02h    ;word size
  772.     jmp    l1630
  773. ;
  774. l18ba:    call    psgprf
  775.     call    pstg
  776.     db    'WORD PTR ',0
  777.     or    byte ptr opdtyp,02h    ;word size
  778.     jmp    l1679
  779. ;
  780. kind29:    inc    bx
  781.     mov    al,es:[bx]
  782.     and    al,38h
  783.     jz    l18db
  784.     jmp    l1c16
  785. ;
  786. l18db:    call    pstg
  787.     db    'MOV',0
  788.     call    tabc
  789.     jmp    l1c19
  790. ;
  791. kind30:    call    tabc
  792.     inc    bx
  793.     mov    al,es:[bx]
  794.     and    al,38h
  795.     shr    al,1
  796.     shr    al,1
  797.     shr    al,1
  798.     call    namr16
  799.     call    comma
  800.     call    l1906
  801.     jmp    dcrlf
  802. ;
  803. l1906:    inc    pcntr
  804.     mov    bx,curadr
  805.     inc    bx
  806.     mov    al,es:[bx]
  807.     and    al,0c0h
  808.     cmp    al,0
  809.     jz    l18a1
  810.     jmp    l18a4
  811. ;
  812. kind38:    call    tabc
  813.     inc    bx
  814.     and    al,38h
  815.     shr    al,1
  816.     shr    al,1
  817.     shr    al,1
  818.     call    namr16
  819.     call    comma
  820.     jmp    l1a19
  821. ;
  822. kind31:    inc    bx
  823.     mov    al,es:[bx]
  824.     and    al,38h
  825.     cmp    al,8
  826.     jnz    l1943
  827.     jmp    l1c16
  828. ;
  829. l1943:    call    pmisci
  830.     call    tabc
  831.     mov    bx,curadr
  832.     inc    bx
  833.     mov    al,es:[bx]
  834.     and    al,38h
  835.     jz    l195a
  836.     call    l17f5
  837.     jmp    dcrlf
  838. ;
  839. l195a:    jmp    l1c19
  840. ;
  841. kind32:    inc    bx
  842.     mov    al,es:[bx]
  843.     and    al,38h
  844.     cmp    al,0
  845.     jz    l1971
  846.     cmp    al,8
  847.     jz    l1971
  848.     jmp    l1c16
  849. ;
  850. l1971:    cmp    al,8
  851.     jz    l197f
  852.     call    pstg
  853.     db    'INC',0
  854.     jmp    l1986
  855. ;
  856. l197f:    call    pstg
  857.     db    'DEC',0
  858. l1986:    call    tabc
  859.     call    l17f5
  860.     jmp    dcrlf
  861. ;
  862. kind33:    inc    bx
  863.     mov    al,es:[bx]    ;2nd instr byte
  864.     and    al,38h        ;sub-opcode
  865.     cmp    al,38h
  866.     jnz    l199f
  867.     jmp    l1c16        ;make db, not instr
  868. ;
  869. l199f:    cmp    al,0        ;inc reg/mem word
  870.     jz    l19bc
  871.     cmp    al,8        ;dec reg/mem word
  872.     jz    l19bc
  873.     cmp    al,30h        ;push reg/mem
  874.     jz    l19da
  875.     cmp    al,18h        ;indir interseg call
  876.     jz    l1a02
  877.     cmp    al,28h        ;indir interseg jmp
  878.     jz    l1a0e
  879.     cmp    al,10h        ;reg/mem indir inseg call
  880.     jz    l19e5
  881.     cmp    al,20h        ;reg/mem indir inseg jmp
  882.     jz    l19f4
  883.     hlt            ;cant get to here
  884. ;
  885. l19bc:    cmp    al,8
  886.     jz    l19ca
  887.     call    pstg
  888.     db    'INC',0
  889.     jmp    l19d1
  890. ;
  891. l19ca:    call    pstg
  892.     db    'DEC',0
  893. l19d1:    call    tabc
  894.     call    l1906
  895.     jmp    dcrlf
  896. ;
  897. l19da:    call    pstg
  898.     db    'PUSH',0
  899.     jmp    l19d1
  900. ;
  901. l19e5:    call    pstg
  902.     db    'CALL',9,0
  903.     call    l17f5
  904.     jmp    dcrlf
  905. ;
  906. l19f4:    call    pstg
  907.     db    'JMP',9,0
  908.     call    l17f5
  909.     mov    cinstr,0e9h    ;fake out for semic delimiter
  910.     jmp    dcrlf
  911. ;
  912. l1a02:    call    pstg
  913.     db    'CALLF',0
  914.     jmp    l1a16
  915. ;
  916. l1a0e:    call    pstg
  917.     db    'JMPF',0
  918.     mov    cinstr,0e9h    ;semic delim fakeout
  919. l1a16:    call    tabc
  920. l1a19:    inc    pcntr
  921.     mov    bx,curadr
  922.     inc    bx
  923.     mov    al,es:[bx]
  924.     and    al,0c0h
  925.     cmp    al,0
  926.     jz    l1a2d
  927.     jmp    l1a41
  928. ;
  929. l1a2d:    call    pstg
  930.     db    'DWORD PTR ',0
  931.     or    byte ptr opdtyp,03h    ;dword size
  932.     call    l1630
  933.     jmp    dcrlf
  934. ;
  935. l1a41:    call    pstg
  936.     db    'DWORD PTR ',0
  937.     or    byte ptr opdtyp,03h    ;dword size
  938.     call    l1679
  939.     jmp    dcrlf
  940. ;
  941. kind34:    call    pstg
  942.     db    ';CALLF TO CSEG',9,0
  943.     inc    bx
  944.     inc    bx
  945.     inc    bx
  946.     mov    dx,es:[bx]
  947.     call    pcon16
  948.     call    dcrlf
  949.     call    tabc
  950.     call    pstg
  951.     db    'CALLF',9,0
  952.     inc    pcntr
  953.     inc    pcntr
  954.     inc    pcntr
  955.     inc    pcntr
  956.     mov    bx,curadr
  957.     inc    bx
  958.     mov    dx,es:[bx]
  959.     call    prtdei
  960.     jmp    dcrlf
  961. ;
  962. kind35:    call    pstg
  963.     db    '; JMPF TO CSEG',9,0
  964.     inc    bx
  965.     inc    bx
  966.     inc    bx
  967.     mov    dx,es:[bx]
  968.     call    pcon16
  969.     call    dcrlf
  970.     call    tabc
  971.     call    pstg
  972.     db    'JMPF',9,0
  973.     inc    pcntr
  974.     inc    pcntr
  975.     inc    pcntr
  976.     inc    pcntr
  977.     mov    bx,curadr
  978.     inc    bx
  979.     mov    dx,es:[bx]
  980.     mov    bx,curadr
  981.     inc    bx
  982.     inc    bx
  983.     inc    bx
  984.     inc    bx
  985.     inc    bx
  986.     sub    bx,curofs
  987.     add    bx,dx
  988.     mov    dx,bx
  989.     call    prntde
  990.     jmp    dcrlf
  991. ;
  992. kind36:    call    tabc
  993.     inc    bx
  994.     mov    dx,es:[bx]
  995.     call    pcon16
  996.     inc    pcntr
  997.     inc    pcntr
  998.     jmp    dcrlf
  999. ;
  1000. kind16:    call    tabc
  1001.     mov    al,es:[bx]
  1002.     and    al,7
  1003.     mov    ah,al
  1004.     inc    bx
  1005.     mov    al,es:[bx]
  1006.     and    al,38h
  1007.     add    ah,al
  1008.     mov    al,ah
  1009.     call    psmnum
  1010.     call    comma
  1011.     call    l187d
  1012.     jmp    dcrlf
  1013. ;
  1014. kind17:    mov    al,es:[bx]
  1015.     and    al,3
  1016.     cmp    al,0
  1017.     jnz    l1b4c
  1018.     call    pstg
  1019.     db    'NE',0
  1020.     jmp    kind21
  1021. ;
  1022. l1b4c:    cmp    al,1
  1023.     jnz    l1b55
  1024.     call    pstg
  1025.     db    'E',0
  1026. l1b55:    jmp    kind21
  1027. ;
  1028. kind18:    call    parit1
  1029.     call    tabc
  1030.     jmp    l1580
  1031. ;
  1032. kind19:    call    tabc
  1033.     jmp    l1580
  1034. ;
  1035. kind39:    inc    bx
  1036.     mov    al,es:[bx]
  1037.     and    al,38h
  1038.     cmp    al,8
  1039.     jz    l1bba
  1040.     cmp    al,20h
  1041.     jz    l1bba
  1042.     cmp    al,30h
  1043.     jz    l1bba
  1044.     call    pstg
  1045.     db    'DB',9,0
  1046.     mov    bx,curadr
  1047.     mov    al,es:[bx]
  1048.     call    psmnum
  1049.     call    comma
  1050.     inc    bx
  1051.     mov    al,es:[bx]
  1052.     call    psmnum
  1053.     call    comma
  1054.     inc    bx
  1055.     mov    al,es:[bx]
  1056.     call    psmnum
  1057.     mov    bx,curadr
  1058.     inc    bx
  1059.     mov    al,es:[bx]
  1060.     and    al,0c0h
  1061.     cmp    al,80h
  1062.     jz    l1bbd
  1063.     cmp    al,40h
  1064.     jz    l1bd6
  1065.     mov    al,es:[bx]
  1066.     and    al,0c7h
  1067.     cmp    al,6
  1068.     jz    l1bbd
  1069.     jmp    l1be3
  1070. ;
  1071. l1bba:    jmp    l1c16
  1072. ;
  1073. l1bbd:    call    comma
  1074.     inc    bx
  1075.     inc    bx
  1076.     mov    al,es:[bx]
  1077.     call    psmnum
  1078.     call    comma
  1079.     inc    bx
  1080.     mov    al,es:[bx]
  1081.     call    psmnum
  1082.     call    dcrlf
  1083.     jmp    l1be3
  1084. ;
  1085. l1bd6:    call    comma
  1086.     inc    bx
  1087.     inc    bx
  1088.     mov    al,es:[bx]
  1089.     call    psmnum
  1090.     call    dcrlf
  1091. l1be3:    call    pstg
  1092.     db    ';',9,0
  1093.     mov    bx,curadr
  1094.     jmp    l1c0c
  1095. ;
  1096. kind20:    mov    al,es:[bx]
  1097.     and    al,2
  1098.     jz    l1c0c
  1099.     inc    bx
  1100.     mov    al,es:[bx]
  1101.     and    al,38h
  1102.     cmp    al,8
  1103.     jz    l1c16
  1104.     cmp    al,20h
  1105.     jz    l1c16
  1106.     cmp    al,30h
  1107.     jz    l1c16
  1108.     dec    bx
  1109. l1c0c:    inc    bx
  1110.     call    parith
  1111.     call    tabc
  1112.     jmp    l1c19
  1113. ;
  1114. l1c16:    jmp    pdbbyt
  1115. ;
  1116. l1c19:    mov    bx,curadr
  1117.     inc    bx
  1118.     mov    al,es:[bx]
  1119.     and    al,0c0h
  1120.     cmp    al,0
  1121.     jz    l1c7a
  1122.     cmp    al,0c0h
  1123.     jz    l1c47
  1124.     jmp    l1c2d
  1125. ;
  1126. l1c2d:    inc    pcntr
  1127.     call    l164f
  1128.     call    comma
  1129.     mov    bx,curadr
  1130.     inc    bx
  1131.     mov    al,es:[bx]
  1132.     inc    bx
  1133.     test    al,80h
  1134.     jz    l1c44
  1135.     inc    bx
  1136. l1c44:    jmp    l1c93
  1137. ;
  1138. l1c47:    inc    pcntr
  1139.     call    l1552
  1140.     call    comma
  1141.     inc    pcntr
  1142.     mov    bx,curadr
  1143.     mov    al,es:[bx]
  1144.     inc    bx
  1145.     inc    bx
  1146. l1c5d:    call    l1cbd
  1147.     jz    l1c66
  1148.     test    al,1
  1149.     jnz    l1c6e
  1150. l1c66:    mov    al,es:[bx]
  1151.     call    psmnum
  1152.     jmp    dcrlf
  1153. ;
  1154. l1c6e:    inc    pcntr
  1155.     mov    dx,es:[bx]
  1156.     call    pcon16
  1157.     jmp    dcrlf
  1158. ;
  1159. l1c7a:    inc    pcntr
  1160.     call    l1606
  1161.     call    comma
  1162.     mov    bx,curadr
  1163.     inc    bx
  1164.     mov    al,es:[bx]
  1165.     and    al,7
  1166.     cmp    al,6
  1167.     jnz    l1c93
  1168.     inc    bx
  1169.     inc    bx
  1170. l1c93:    inc    bx
  1171.     inc    pcntr
  1172.     push    bx
  1173.     mov    bx,curadr
  1174.     mov    al,es:[bx]
  1175.     pop    bx
  1176.     jmp    l1c5d        ;share common code
  1177. ;
  1178. l1cbd:    push    bx
  1179.     push    ax
  1180.     mov    bx,curadr
  1181.     mov    al,es:[bx]
  1182.     cmp    al,83h
  1183.     pop    ax
  1184.     pop    bx
  1185.     ret
  1186. ;
  1187. comma:    mov    al,','    ;2ch
  1188.     jmp    typech
  1189. ;
  1190. tabc:    mov    al,9
  1191.     jmp    typech
  1192. ;
  1193. semic:    mov    al,';'    ;3bh
  1194.     jmp    typech
  1195. ;
  1196. colon:    mov    al,':'    ;3ah
  1197.     jmp    typech
  1198. ;
  1199. pdbbyt:    call    pstg
  1200.     db    'DB',9,0
  1201.     jmp    bytopd
  1202. ;
  1203. psgpfx:    shr    al,1
  1204.     shr    al,1
  1205.     mov    bx,offset segtbl
  1206.     mov    ch,2
  1207.     call    addfn
  1208.     jmp    popstx
  1209. ;
  1210. pndxop:    mov    bx,offset indtbl
  1211.     push    bx
  1212. l1d05:    mov    bx,curadr
  1213.     inc    bx
  1214.     mov    al,es:[bx]
  1215.     and    al,7
  1216.     shl    al,1
  1217.     shl    al,1
  1218.     shl    al,1
  1219.     pop    bx
  1220.     mov    ch,8
  1221.     call    addfn
  1222.     jmp    popstx
  1223. ;
  1224. pmisci:    mov    bx,curadr
  1225.     inc    bx
  1226.     mov    al,es:[bx]
  1227.     and    al,38h
  1228.     shr    al,1
  1229.     mov    bx,offset msctbl
  1230.     mov    ch,4
  1231.     call    addfn
  1232.     jmp    popstx
  1233. ;
  1234. pshfop:    mov    bx,curadr
  1235.     inc    bx
  1236.     mov    al,es:[bx]
  1237.     and    al,38h
  1238.     shr    al,1
  1239.     shr    al,1
  1240.     mov    ah,al
  1241.     shr    al,1
  1242.     add    al,ah
  1243.     mov    bx,offset shftbl
  1244.     jmp    popst3
  1245. ;
  1246. parit1:    mov    bx,curadr
  1247. parith:    mov    al,es:[bx]
  1248.     and    al,38h
  1249.     shr    al,1
  1250.     shr    al,1
  1251.     mov    ah,al
  1252.     shr    al,1
  1253.     add    al,ah
  1254.     mov    bx,offset aritbl
  1255.     jmp    popst3
  1256. ;
  1257. pcndop:    mov    bx,curadr
  1258.     mov    al,es:[bx]
  1259.     and    al,0fh
  1260.     mov    ch,al
  1261.     add    al,al
  1262.     add    al,ch
  1263.     mov    bx,offset cndtbl
  1264. popst3:    mov    ch,3
  1265.     call    addfn
  1266. popstx:    mov    al,cs:byte ptr [bx]
  1267.     cmp    al,'.'    ;2eh
  1268.     jz    popskp
  1269.     call    typech
  1270. popskp:    inc    bx
  1271.     dec    ch
  1272.     jnz    popstx
  1273.     ret
  1274. ;
  1275. pqtchr:    push    ax
  1276.     mov    al,''''    ;27h
  1277.     call    typech
  1278.     pop    ax
  1279.     cmp    al,''''    ;27h
  1280.     jz    pqtqt
  1281.     jmp    typech
  1282. ;
  1283. pqtqt:    push    ax
  1284.     call    typech
  1285.     pop    ax
  1286.     jmp    typech
  1287. ;
  1288. addfn:    add    al,bl
  1289.     mov    bl,al
  1290.     jb    l1da6
  1291.     ret
  1292. ;
  1293. l1da6:    inc    bh
  1294.     ret
  1295. ;
  1296. xo0:    cmp    al,0a0h
  1297.     jnb    l1db0
  1298.     jmp    xo
  1299. ;
  1300. l1db0:    push    ax
  1301.     mov    al,'0'    ;30h
  1302.     call    typech
  1303.     pop    ax
  1304.     jmp    xo
  1305. ;
  1306. pstrg:    mov    al,byte ptr [bx]
  1307.     call    typech
  1308.     inc    bx
  1309.     dec    ch
  1310.     jnz    pstrg
  1311.     ret
  1312. ;
  1313. ;
  1314. segtbl    db    'ES','CS','SS','DS'
  1315. ;
  1316. cndtbl    db    'O..','NO.','B..','NB.'
  1317.     db    'Z..','NZ.','NA.','A..'
  1318.     db    'S..','NS.','PE.','PO.'
  1319.     db    'NGE','GE.','NG.','G..'
  1320. ;
  1321. shftbl    db    'ROL','ROR','RCL','RCR'
  1322.     db    'SHL','SHR','...','SAR'
  1323. ;
  1324. msctbl    db    'TEST','....','NOT.','NEG.'
  1325.     db    'MUL.','IMUL','DIV.','IDIV'
  1326. ;
  1327. aritbl    db    'ADD','OR.','ADC','SBB'
  1328.     db    'AND','SUB','XOR','CMP'
  1329. ;
  1330. indtbl    db    '[BX+SI].','[BX+DI].','[BP+SI].','[BP+DI].'
  1331.     db    '[SI]....','[DI]....','........','[BX]....'
  1332.     db    '[BX+SI].','[BX+DI].','[BP+SI].','[BP+DI].'
  1333.     db    '[SI]....','[DI]....','........','[BX]....'
  1334. ;
  1335. ;
  1336. ;    opcode mask, opcode pattern, kind, literal
  1337. ;
  1338. opct    db    0ffh,098h,00,'CBW..'    ;no operands
  1339.     db    0ffh,027h,00,'DAA..'
  1340.     db    0ffh,02fh,00,'DAS..'
  1341.     db    0ffh,037h,00,'AAA..'
  1342.     db    0ffh,0d7h,10,'XLAT.'
  1343.     db    0ffh,0c3h,00,'RET..'
  1344.     db    0ffh,0cbh,00,'RETF.'
  1345.     db    0ffh,099h,00,'CWD..'
  1346.     db    0ffh,09bh,00,'WAIT.'
  1347.     db    0ffh,09ch,00,'PUSHF'
  1348.     db    0ffh,09dh,00,'POPF.'
  1349.     db    0ffh,09eh,00,'SAHF.'
  1350.     db    0ffh,09fh,00,'LAHF.'
  1351.     db    0ffh,0ceh,00,'INTO.'
  1352.     db    0ffh,0cfh,00,'IRET.'
  1353.     db    0ffh,0f4h,00,'HLT..'
  1354.     db    0ffh,0f5h,00,'CMC..'
  1355.     db    0ffh,0f8h,00,'CLC..'
  1356.     db    0ffh,0f9h,00,'STC..'
  1357.     db    0ffh,0fah,00,'CLI..'
  1358.     db    0ffh,0fbh,00,'STI..'
  1359.     db    0ffh,0fch,00,'CLD..'
  1360.     db    0ffh,0fdh,00,'STD..'
  1361.     db    0ffh,090h,00,'NOP..'
  1362.     db    0ffh,03fh,00,'AAS..'
  1363.     db    0f8h,040h,15,'INC..'    ;one 16 bit reg
  1364.     db    0f8h,048h,15,'DEC..'
  1365.     db    0f8h,050h,15,'PUSH.'
  1366.     db    0f8h,058h,15,'POP..'
  1367.     db    0ffh,0f3h,09,'REP..'    ;prefix
  1368.     db    0ffh,0f2h,09,'REPNZ'
  1369.     db    0f8h,090h,13,'XCHG.'
  1370.     db    0feh,0a4h,12,'MOVS.'    ;string functs
  1371.     db    0feh,0a6h,12,'CMPS.'
  1372.     db    0feh,0aah,22,'STOS.'
  1373.     db    0feh,0ach,22,'LODS.'
  1374.     db    0feh,0aeh,22,'SCAS.'
  1375.     db    0ffh,0f0h,09,'LOCK.'
  1376.     db    0fch,0d0h,26,'.....'
  1377.     db    0ffh,08fh,27,'.....'
  1378.     db    0ffh,08ch,28,'.....'
  1379.     db    0ffh,08eh,28,'.....'
  1380.     db    0feh,0c6h,29,'.....'
  1381.     db    0ffh,0c4h,38,'LES..'
  1382.     db    0ffh,0c5h,38,'LDS..'
  1383.     db    0feh,0f6h,31,'.....'
  1384.     db    0ffh,0feh,32,'.....'
  1385.     db    0ffh,0ffh,33,'.....'    ;misc call/jmp
  1386.     db    0ffh,09ah,34,'.....'
  1387.     db    0ffh,0eah,35,'.....'
  1388.     db    0f8h,0d8h,16,'ESC..'
  1389.     db    0ffh,0c2h,36,'RET..'
  1390.     db    0ffh,0cah,36,'RETF.'
  1391.     db    0ffh,026h,23,'.....'    ;seg ovrd prefix
  1392.     db    0ffh,02eh,23,'.....'
  1393.     db    0ffh,036h,23,'.....'
  1394.     db    0ffh,03eh,23,'.....'
  1395.     db    0ffh,004h,04,'ADD..'    ;arith 8 bit to acc
  1396.     db    0ffh,00ch,04,'OR...'
  1397.     db    0ffh,014h,04,'ADC..'
  1398.     db    0ffh,01ch,04,'SBB..'
  1399.     db    0ffh,024h,04,'AND..'
  1400.     db    0ffh,02ch,04,'SUB..'
  1401.     db    0ffh,034h,04,'XOR..'
  1402.     db    0ffh,03ch,04,'CMP..'
  1403.     db    0ffh,0a8h,04,'TEST.'
  1404.     db    0fch,080h,20,'.....'    ;arith immed to reg/mem
  1405.     db    0ffh,080h,39,'.....'
  1406.     db    0ffh,005h,06,'ADD..'    ;arith 16 bit to acc
  1407.     db    0ffh,00dh,06,'OR...'
  1408.     db    0ffh,015h,06,'ADC..'
  1409.     db    0ffh,01dh,06,'SBB..'
  1410.     db    0ffh,025h,06,'AND..'
  1411.     db    0ffh,02dh,06,'SUB..'
  1412.     db    0ffh,035h,06,'XOR..'
  1413.     db    0ffh,03dh,06,'CMP..'
  1414.     db    0ffh,0a9h,06,'TEST.'
  1415.     db    0f0h,0b0h,03,'MOV..'
  1416.     db    0fch,0a0h,25,'MOV..'
  1417.     db    0ffh,0e4h,37,'IN...'
  1418.     db    0ffh,0e6h,37,'OUT..'
  1419.     db    0ffh,0e5h,02,'IN...'
  1420.     db    0ffh,0e7h,02,'OUT..'
  1421.     db    0feh,0ech,01,'IN...'
  1422.     db    0feh,0eeh,01,'OUT..'
  1423.     db    0c4h,000h,18,'.....'
  1424.     db    0feh,084h,19,'TEST.'
  1425.     db    0feh,086h,19,'XCHG.'
  1426.     db    0fch,088h,19,'MOV..'
  1427.     db    0ffh,08dh,30,'LEA..'
  1428.     db    0ffh,0cch,00,'INT 3'
  1429.     db    0ffh,0cdh,07,'INT..'
  1430.     db    0ffh,0d4h,08,'AAM..'
  1431.     db    0ffh,0d5h,08,'AAD..'
  1432.     db    0f0h,070h,11,'J....'
  1433.     db    0ffh,0e3h,21,'JCXZ.'
  1434.     db    0ffh,0ebh,21,'JMPS.'
  1435.     db    0ffh,0e8h,05,'CALL.'
  1436.     db    0ffh,0e9h,05,'JMP..'
  1437.     db    0feh,0e0h,17,'LOOP.'
  1438.     db    0ffh,0e2h,17,'LOOP.'
  1439.     db    0ffh,006h,24,'PUSH.'
  1440.     db    0ffh,007h,24,'POP..'
  1441.     db    0ffh,00eh,24,'PUSH.'
  1442.     db    0ffh,016h,24,'PUSH.'
  1443.     db    0ffh,017h,24,'POP..'
  1444.     db    0ffh,01eh,24,'PUSH.'
  1445.     db    0ffh,01fh,24,'POP..'
  1446.     db    0ffh,060h,00,'PUSHA'    ;80186
  1447.     db    0ffh,061h,00,'POPA.'    ;80186
  1448.     db    0ffh,062h,14,'.....'    ;80186 bound
  1449.     db    0fdh,068h,14,'.....'    ;80186 push/pop immed
  1450.     db    0fdh,069h,14,'.....'    ;80186 imul immed
  1451.     db    0feh,06ch,14,'.....'    ;80186 ins [dx]
  1452.     db    0feh,06eh,14,'.....'    ;80186 outs [dx]
  1453.     db    0feh,0c0h,14,'.....'    ;80186 shft by cnt
  1454.     db    0ffh,0c8h,14,'.....'    ;80186 enter
  1455.     db    0ffh,0c9h,00,'LEAVE'    ;80186
  1456.     db    0ffh,0f2h,14,'.....'    ;80186 ins/outs (cc-cf)
  1457.     db    0f0h,060h,14,'.....'    ;unimplemented codes
  1458.     db    0ffh,00fh,14,'.....'
  1459.     db    0ffh,0d6h,14,'.....'
  1460.     db    0ffh,0f1h,14,'.....'
  1461.     db    0
  1462. ;
  1463. ;
  1464. ;    symbol table structure, variable lgth records
  1465. ;    2 bytes address, 1 byte string lgth, 
  1466. ;    1 byte seg/type, n bytes literal string
  1467. ;    table end defined by lgth byte = 0
  1468. ;    first free byte pntd by symtp
  1469. ;    table stored in ascii string sort order
  1470. ;    type b1-0: 0=instr, 1=byte, 2=word, 3=dword
  1471. ;    type b3-2: 0=ss, 1=ds, 2=es, 3=cs
  1472. ;    (b3 inverted from instr. code)
  1473. ;
  1474. addsym:    mov    bx,offset cmdbuf    ;generate symbol literal
  1475.     mov    byte ptr [bx],'L'    ;first symbol char
  1476.     inc    bx
  1477.     mov    al,dh
  1478.     call    stohex
  1479.     mov    al,dl
  1480.     call    stohex
  1481.     mov    bx,offset cmdbuf
  1482.     mov    ch,5        ;fixed string lenght
  1483. symtch:    call    locsym
  1484.     jb    entsym        ;if sym at addr doesnt exist
  1485.     mov    [bx],dx
  1486.     inc    bx
  1487.     ret
  1488. ;
  1489. entsym:    push    bx        ;open up space for new entry
  1490.     push    dx
  1491.     push    cx
  1492.     mov    bx,symtp
  1493.     mov    dx,bx
  1494.     mov    al,ch
  1495.     mov    ah,0
  1496.     add    al,4
  1497.     add    bx,ax
  1498.     mov    symtp,bx     ;new end
  1499.     mov    byte ptr 3[bx],0    ;zero lgth byte
  1500.     mov    cx,bx
  1501.     mov    bx,insloc
  1502. l22a5:    cmp    dx,bx
  1503.     jz    inssym
  1504.     dec    dx
  1505.     dec    cx
  1506.     xchg    bx,dx
  1507.     mov    al,[bx]
  1508.     xchg    bx,dx
  1509.     xchg    bx,cx
  1510.     mov    [bx],al
  1511.     xchg    bx,cx
  1512.     jmp    l22a5
  1513. ;
  1514. inssym:    pop    cx        ;put new entry in hole just made
  1515.     pop    dx
  1516.     mov    [bx],dx
  1517.     inc    bx
  1518.     inc    bx
  1519.     mov    al,opdtyp
  1520.     mov    [bx],al
  1521.     inc    bx
  1522.     mov    [bx],ch
  1523.     pop    dx
  1524. l22cb:    inc    bx
  1525.     xchg    bx,dx
  1526.     mov    al,[bx]
  1527.     xchg    bx,dx
  1528.     mov    [bx],al
  1529.     inc    dx
  1530.     dec    ch
  1531.     jnz    l22cb
  1532.     ret
  1533. ;
  1534. locsym:    push    dx        ;find symbol by literal match
  1535.     push    bx        ;string start
  1536.     mov    bx,offset symbas
  1537. nxstch:    pop    dx
  1538.     push    dx    ;string start
  1539.     inc    bx
  1540.     inc    bx
  1541.     inc    bx    ;skip fixed fields
  1542.     push    bx
  1543.     mov    al,[bx]        ;string lgth
  1544.     inc    bx
  1545.     or    al,al
  1546.     jz    strstp        ;table end
  1547.     cmp    al,ch        ;compare lengths
  1548.     jb    shtstr        ;table is shorter
  1549.     jnz    lngstr
  1550.     mov    cl,al        ;compare count
  1551.     call    cmpstr
  1552.     jz    symfnd        ;found right string
  1553.     jb    strstp        ;gone too far
  1554. l22fa:    pop    bx        ;table pntr
  1555.     mov    al,[bx]
  1556.     inc    bx        ;string start
  1557.     sub    ah,ah        ;zero hi byte
  1558.     add    bx,ax
  1559.     jmp    nxstch
  1560. ;
  1561. symfnd:    pop    bx        ;strg size ptr
  1562.     dec    bx
  1563.     dec    bx
  1564.     dec    bx    ;back to entry start
  1565.     pop    dx    ;adj stack
  1566.     pop    dx    ;restore dx
  1567.     or    al,al    ;adjust flags
  1568.     ret
  1569. ;
  1570. shtstr:    mov    cl,al    ;shorter size
  1571.     call    cmpstr
  1572.     jnb    l22fa
  1573.     jmp    strstp
  1574. ;
  1575. lngstr:    mov    cl,ch    ;shorter size
  1576.     call    cmpstr
  1577.     jz    strstp
  1578.     jnb    l22fa
  1579. strstp:    pop    bx        ;not found exit, set best approx ptr
  1580.     dec    bx
  1581.     dec    bx
  1582.     dec    bx    ;record start
  1583.     mov    insloc,bx    ;closest match ptr for insert
  1584.     pop    bx
  1585.     pop    dx
  1586.     stc        ;not found flag
  1587.     ret
  1588. ;
  1589. symluk:    mov    bx,offset symbas    ;lookup symbol for usage
  1590. symlk2:    mov    ax,[bx]            ;by address in dx
  1591.     inc    bx
  1592.     cmp    ax,dx
  1593.     jz    symlk6            ;right address
  1594.     inc    bx
  1595.     inc    bx
  1596. symlk3:    mov    al,[bx]            ;possible end flag
  1597.     or    al,al
  1598.     stc
  1599.     jnz    l2348            ;not end
  1600.     ret
  1601. ;
  1602. l2348:    inc    bx            ;count size byte
  1603.     mov    ah,0
  1604.     add    bx,ax            ;adj for string size
  1605.     jmp    short symlk2
  1606. ;
  1607. symlk6:    inc    bx
  1608.     mov    al,[bx]            ;flag byte
  1609.     mov    symtyp,al        ;flags for this symbol
  1610.     inc    bx
  1611.     test    byte ptr nrsegs,0feh    ;more than one?
  1612.     jz    mdl80            ;only one segment
  1613.     xor    al,opdtyp        ;= current?
  1614.     and    al,00ch            ;isolate seg bits
  1615.     jnz    symlk3            ;if not rite segment
  1616. mdl80:    mov    al,[bx] ;string size
  1617.     inc    bx
  1618.     mov    ch,al
  1619.     or    al,al
  1620.     jnz    l235fn
  1621.     stc
  1622. l235fn:    ret
  1623. ;
  1624. ;
  1625. ;
  1626. cmentr:    mov    bx,offset cmdbuf+3h
  1627.     call    gtval        ;symbol value
  1628.     mov    al,[bx]
  1629.     call    delim        ;must exist
  1630. l2374:    inc    bx
  1631.     mov    al,[bx]
  1632.     cmp    al,'.'
  1633.     jz    l237e        ;must prefix string
  1634.     call    cmerr
  1635. ;
  1636. l237e:    push    dx    ;value
  1637.     push    bx    ;buffer pointer
  1638. ;    ensure label doesnt exist
  1639.     call    lngth        ;parse string
  1640.     call    locsym
  1641.     jb    nohit
  1642.     call    prtstr
  1643.     db    'Duplicate label - not entered',0dh,0ah,7,0
  1644.     call    cmerr
  1645. ;
  1646. nohit:    pop    bx
  1647.     pop    dx
  1648.     push    dx        ;restore regs to
  1649.     push    bx        ;value & buff ptr
  1650.     call    symluk
  1651.     jb    symnf
  1652.     push    bx
  1653.     call    ucrlf
  1654.     call    pstrg
  1655.     call    prtstr
  1656.     db    ' was killed.',7,0dh,0ah,0
  1657.     pop    bx
  1658.     dec    bx
  1659.     dec    bx
  1660.     mov    al,[bx]        ;old flags
  1661.     mov    opdtyp,al    ;for new symbol
  1662.     dec    bx
  1663.     dec    bx
  1664.     call    lkill
  1665. symnf:    pop    bx        ;orig cmd ptr
  1666.     call    lngth
  1667.     pop    dx        ;symbol value
  1668.     call    symtch
  1669.     jmp    nxcmd
  1670. ;
  1671. ;
  1672. ;
  1673. cmkill:    mov    bx,offset cmdbuf+3
  1674.     mov    al,[bx]
  1675.     cmp    al,'.'        ;2eh
  1676.     jz    l2396
  1677.     call    cmerr
  1678. ;
  1679. l2396:    call    lngth
  1680.     call    locsym
  1681.     jnb    l23a1        ;found it
  1682.     call    cmerr
  1683. ;
  1684. l23a1:    call    lkill
  1685.     jmp    nxcmd
  1686. ;
  1687. lkill:    mov    cx,bx
  1688.     inc    bx
  1689.     inc    bx
  1690.     inc    bx
  1691.     mov    al,[bx]
  1692.     sub    ah,ah
  1693.     add    bx,ax
  1694.     inc    bx
  1695.     xchg    bx,dx        ;hold in dx
  1696.     mov    bx,symtp
  1697. l23b8:    cmp    dx,bx        ;at top yet?
  1698.     jz    l23d5
  1699.     xchg    bx,dx
  1700.     mov    al,[bx]    ;from [dx]
  1701.     xchg    bx,dx
  1702.     xchg    bx,cx
  1703.     mov    [bx],al    ;to [cx]
  1704.     xchg    bx,cx
  1705.     inc    cx
  1706.     inc    dx
  1707.     jmp    l23b8
  1708. ;
  1709. l23d5:    mov    bx,cx
  1710.     mov    symtp,bx    ;new top
  1711.     mov    byte ptr 3[bx],0
  1712.     ret
  1713. ;
  1714. lngth:    inc    bx    ;skip dot symbol flag
  1715.     mov    ch,0    ;clear counter
  1716.     push    bx    ;save string start pntr
  1717. nxtcnt:    mov    al,[bx]    ;char to test
  1718.     inc    bx
  1719.     inc    ch    ;count it
  1720.     cmp    al,','
  1721.     jz    gettyp
  1722.     cmp    al,'+'    ;2bh
  1723.     jz    nxtcnt
  1724.     cmp    al,'-'    ;2dh
  1725.     jz    nxtcnt
  1726.     cmp    al,'0'    ;30h
  1727.     jb    endcnt
  1728.     cmp    al,'9'+1    ;3ah
  1729.     jb    nxtcnt
  1730.     cmp    al,'A'    ;41h
  1731.     jb    endcnt
  1732.     cmp    al,'Z'+1
  1733.     jb    nxtcnt
  1734. endcnt:    dec    ch    ;dont count terminator
  1735.     jnz    gudcnt
  1736. ervec1:    call    cmerr
  1737. ;
  1738. gudcnt:    dec    bx
  1739.     xchg    bx,dx    ;delimiter pntr in dx
  1740.     pop    bx    ;string start pntr in bx
  1741.     ret
  1742. ;
  1743. gettyp:    mov    al,[bx]        ;next char is type
  1744.     cmp    al,'.'        ;may be a string coming
  1745.     jz    endcnt        ;yes, leave alone now
  1746.     cmp    al,'@'
  1747.     jb    ervec1
  1748.     cmp    al,'P'
  1749.     jnb    ervec1
  1750.     mov    opdtyp,al    ;put where inssym wants it
  1751.     jmp    endcnt        ;done now
  1752. ;
  1753. stohex:    push    ax
  1754.     call    hexl
  1755.     mov    [bx],al
  1756.     inc    bx
  1757.     pop    ax
  1758.     call    hexr
  1759.     mov    [bx],al
  1760.     inc    bx
  1761.     ret
  1762. ;
  1763. hexl:    rcr    al,1
  1764.     rcr    al,1
  1765.     rcr    al,1
  1766.     rcr    al,1
  1767. hexr:    and    al,0fh
  1768.     cmp    al,0ah
  1769.     jb    hexrn
  1770.     add    al,7
  1771. hexrn:    add    al,'0'    ;30h
  1772.     ret
  1773. ;
  1774. xo:    push    ax
  1775.     call    hexl
  1776.     call    typech
  1777.     pop    ax
  1778.     call    hexr
  1779.     jmp    typech
  1780. ;
  1781. prword:    mov    al,bh
  1782.     call    xo
  1783.     mov    al,bl
  1784.     call    xo
  1785. prspc:    mov    al,' '        ;20h
  1786.     jmp    typech
  1787. ;
  1788. gtval:    mov    al,[bx]
  1789.     cmp    al,'.'        ;2eh
  1790.     jz    gtsymb
  1791.     mov    dx,0
  1792. hexbi:    mov    al,[bx]
  1793.     cmp    al,'0'    ;30h
  1794.     jnb    l245f
  1795.     ret
  1796. ;
  1797. l245f:    cmp    al,'9'+1    ;3ah
  1798.     jb    cvnum
  1799.     cmp    al,'A'    ;41h
  1800.     jnb    l2468
  1801.     ret
  1802. ;
  1803. l2468:    cmp    al,'G'    ;47h
  1804.     jb    l246d
  1805.     ret
  1806. ;
  1807. l246d:    sub    al,7
  1808. cvnum:    sub    al,'0'    ;30h
  1809.     xchg    bx,dx
  1810.     add    bx,bx
  1811.     add    bx,bx
  1812.     add    bx,bx
  1813.     add    bx,bx
  1814.     add    al,bl
  1815.     mov    bl,al
  1816.     xchg    bx,dx
  1817.     inc    bx
  1818.     jmp    hexbi
  1819. ;
  1820. gtsymb:    call    lngth
  1821.     push    dx
  1822.     call    locsym
  1823.     jnb    l2491        ;it exists
  1824.     call    cmerr
  1825. ;
  1826. l2491:    mov    dx,[bx]        ;symbol value
  1827.     pop    bx
  1828.     mov    al,[bx]    ;string terminator
  1829.     ret
  1830. ;
  1831. ;
  1832. fopen:    push    bx
  1833.     mov    bx,offset tbuf+128
  1834.     mov    ofiptr,bx
  1835.     xor    al,al
  1836.     mov    byte ptr fcb+32,al
  1837.     mov    dx,offset fcb
  1838.     mov    ah,0fh
  1839.     call    bdos
  1840.     pop    bx
  1841.     inc    al
  1842.     jz    l24b3
  1843.     ret
  1844. ;
  1845. l24b3:    call    prtstr
  1846.     db    '++FILE NOT FOUND',0dh,0ah,0
  1847.     stc
  1848.     ret
  1849. ;
  1850. fclose:    mov    dx,offset fcb
  1851.     mov    ah,16
  1852.     call    bdos
  1853.     ret
  1854. ;
  1855. rdfchr:    push    bx
  1856.     mov    bx,ofiptr
  1857.     test    bh,1
  1858.     jz    l24ea
  1859.     push    cx
  1860.     push    dx
  1861.     mov    dx,offset fcb
  1862.     mov    ah,14h
  1863.     call    bdos
  1864.     or    al,al
  1865.     pop    dx
  1866.     pop    cx
  1867.     mov    bx,offset tbuf
  1868.     jnz    l24f3
  1869. l24ea:    mov    al,[bx]
  1870.     inc    bx
  1871.     mov    ofiptr,bx
  1872.     pop    bx
  1873.     ret
  1874. ;
  1875. l24f3:    cmp    al,3
  1876.     jb    mrkeof
  1877.     call    prtstr
  1878.     db    '++UNEXPECTED EOF',0dh,0ah,0
  1879.     jmp    nxcmd
  1880. ;
  1881. mrkeof:    mov    al,1ah
  1882.     mov    [bx],al
  1883.     jmp    l24ea
  1884. ;
  1885. creatf:    push    bx
  1886.     mov    dx,offset fcb
  1887.     mov    ah,13h
  1888.     call    bdos
  1889.     mov    dx,offset fcb
  1890.     mov    ah,16h
  1891.     call    bdos
  1892.     inc    al
  1893.     jnz    l252f
  1894.     call    cmerr
  1895. ;
  1896. l252f:    xor    al,al
  1897.     mov    byte ptr fcb+32,al
  1898.     mov    bx,offset tbuf
  1899.     mov    ofiptr,bx
  1900.     pop    bx
  1901.     ret
  1902. ;
  1903. flushf:    mov    dx,offset fcb
  1904.     mov    ah,15h
  1905.     call    bdos
  1906.     or    al,al
  1907.     jnz    l256c
  1908.     mov    dx,offset fcb
  1909.     mov    ah,10h
  1910.     call    bdos
  1911.     inc    al
  1912.     jz    l2556
  1913.     ret
  1914. ;
  1915. l2556:    call    prtstr
  1916.     db    '++CLOSE ERROR',0dh,0ah,0
  1917.     jmp    nxcmd
  1918. ;
  1919. l256c:    call    prtstr
  1920.     db    '++WRITE ERROR',0dh,0ah,0
  1921. wtfchr:    push    bx
  1922.     mov    bx,ofiptr
  1923.     mov    [bx],al
  1924.     inc    bl
  1925.     mov    ofiptr,bx
  1926.     pop    bx
  1927.     jz    l2590
  1928.     ret
  1929. ;
  1930. l2590:    push    cx
  1931.     push    dx
  1932.     push    bx
  1933.     mov    dx,offset fcb
  1934.     mov    ah,15h
  1935.     call    bdos
  1936.     or    al,al
  1937.     jnz    l256c
  1938.     mov    bx,offset tbuf
  1939.     mov    ofiptr,bx
  1940.     pop    bx
  1941.     pop    dx
  1942.     pop    cx
  1943.     ret
  1944. ;
  1945. ;
  1946. dcrlf:    mov    bx,xcptr
  1947.     mov    al,bh
  1948.     or    al,bl
  1949.     jz    dcrlf3
  1950.     call    tabc
  1951.     mov    ch,[bx]
  1952.     xor    al,al
  1953.     or    al,ch
  1954.     jz    dcrlf2
  1955. dcrlf1:    inc    bx
  1956.     mov    al,[bx]
  1957.     call    typech
  1958.     dec    ch
  1959.     jnz    dcrlf1
  1960. dcrlf2:    mov    bx,0
  1961.     mov    xcptr,bx
  1962. dcrlf3:    mov    rplptr,bx
  1963.     xor    al,al
  1964.     mov    replsw,al
  1965. ;
  1966. crlf:    mov    al,cinstr
  1967.     cmp    al,0c3h        ;return
  1968.     jz    separ
  1969.     cmp    al,0e9h        ;jmp
  1970.     jz    separ
  1971.     cmp    al,0ebh        ;jmps
  1972.     jz    separ
  1973.     cmp    al,0c2h        ;reti
  1974.     jz    separ
  1975.     cmp    al,0cah        ;reti
  1976.     jz    separ
  1977.     cmp    al,0cbh        ;reti
  1978.     jz    separ
  1979.     cmp    al,0cfh        ;tret
  1980.     jz    separ
  1981.     cmp    al,0eah        ;jmpf
  1982.     jz    separ
  1983. ;    more can go here .....
  1984. ucrlf:    mov    al,0dh
  1985.     call    typech
  1986.     mov    al,0ah
  1987.     jmp    typech
  1988. ;
  1989. separ:    call    ucrlf
  1990.     mov    al,';'
  1991.     mov    cinstr,al
  1992.     call    typech
  1993.     jmp    ucrlf
  1994. ;
  1995. pstar:    mov    al,'*'    ;2ah
  1996. ;
  1997. typech:    push    cx
  1998.     push    dx
  1999.     push    bx
  2000.     mov    dl,al
  2001.     mov    al,replsw
  2002.     or    al,al
  2003.     jnz    notlf
  2004.     push    dx
  2005.     mov    ah,2
  2006.     mov    al,quiflg
  2007.     or    al,al
  2008.     jnz    l25c8
  2009.     push    es
  2010.     call    bdos
  2011.     pop    es
  2012. l25c8:    pop    dx
  2013.     mov    al,wrtflg
  2014.     mov    bx,offset wfiflg
  2015.     and    al,[bx]
  2016.     mov    al,dl
  2017.     jz    l25d8
  2018.     call    wtfchr
  2019. l25d8:    mov    al,dl
  2020.     cmp    al,0ah
  2021.     jnz    notlf
  2022.     mov    al,cntenb
  2023.     or    al,al
  2024.     jz    notlf
  2025.     mov    bx,offset liscnt+1
  2026.     dec    byte ptr [bx]
  2027. notlf:    pop    bx
  2028.     pop    dx
  2029.     pop    cx
  2030.     ret
  2031. ;
  2032. ;
  2033. gtcmd:    mov    bx,offset segsho    ;prompt string
  2034.     mov    ch,3
  2035.     call    pstrg
  2036.     mov    dx,offset cmdbuf 
  2037.     mov    al,78    ;4eh
  2038.     xchg    bx,dx
  2039.     mov    [bx],al
  2040.     xchg    bx,dx
  2041.     mov    ah,10        ;line input funct
  2042.     call    bdos
  2043.     mov    bx,offset cmdbuf+1
  2044.     mov    dl,[bx]
  2045.     mov    dh,0
  2046.     add    bx,dx
  2047.     inc    bx
  2048.     mov    byte ptr [bx],0dh
  2049.     mov    bx,offset cmdbuf+1
  2050. ltucnv:    inc    bx
  2051.     mov    al,[bx]
  2052.     cmp    al,0dh
  2053.     jnz    l261b
  2054.     jmp    crlf
  2055. ;
  2056. l261b:    cmp    al,'a'
  2057.     jb    ltucnv
  2058.     cmp    al,'z'+1
  2059.     jnb    ltucnv
  2060.     and    al,5fh
  2061.     mov    [bx],al
  2062.     jmp    ltucnv
  2063. ;
  2064. prtstr:    xor    al,al
  2065.     mov    wfiflg,al
  2066.     mov    quiflg,al
  2067. pstg:    pop    si
  2068.     xchg    bx,si
  2069.     push    si
  2070. ostrlp:    mov    al,cs:[bx]
  2071.     call    typech
  2072.     inc    bx
  2073.     mov    al,cs:[bx]
  2074.     or    al,al
  2075.     jnz    ostrlp
  2076.     inc    bx
  2077.     pop    si
  2078.     xchg    bx,si
  2079.     push    si
  2080.     ret
  2081. ;
  2082. ;
  2083. initbl:    xor    al,al
  2084.     mov    byte ptr symbas+3,al    ;zero size byte
  2085.     mov    bx,offset symbas
  2086.     mov    symtp,bx        ;top = bottom
  2087.     mov    al,0dh
  2088.     mov    byte ptr cmdbuf+3,al    ;null command
  2089.     mov    byte ptr ctlbas,' '
  2090.     mov    word ptr ctlbas+1,-1    ;end flag in addr
  2091.     mov    cfence,'I'        ;initial mode set
  2092.     mov    bx,offset ctlbas+0c00h
  2093.     mov    ctltop,bx        ;expansion limit
  2094.     mov    bx,doctbl
  2095.     mov    al,bh
  2096.     or    al,bl        ;test if defined
  2097.     jnz    l2670
  2098.     ret
  2099. ;
  2100. l2670:    mov    docend,bx    ;end = start
  2101.     mov    word ptr [bx],0ffffh    ;end flag in place
  2102.     ret
  2103. ;
  2104. cmpstr:    xchg    bx,dx
  2105.     mov    al,[bx]
  2106.     xchg    bx,dx
  2107.     cmp    al,[bx]
  2108.     jz    l2685
  2109.     ret
  2110. ;
  2111. l2685:    inc    dx
  2112.     inc    bx
  2113.     dec    cl
  2114.     jnz    cmpstr
  2115.     ret
  2116. ;
  2117. keychk:    push    cx
  2118.     push    dx
  2119.     push    bx
  2120.     mov    ah,0bh
  2121.     call    bdos
  2122.     or    al,al
  2123.     jz    l26cc
  2124.     mov    ah,1
  2125.     call    bdos
  2126.     cmp    al,3
  2127.     jz    abort
  2128.     call    crlf
  2129.     jmp    nxcmd
  2130. ;
  2131. abort:    call    prtstr
  2132.     db    0dh,0ah,'ABORT Y/N ',0
  2133.     mov    ah,1
  2134.     call    bdos
  2135.     and    al,5fh
  2136.     cmp    al,'Y'    ;59h
  2137.     jnz    l26c9
  2138.     mov    ah,0
  2139.     mov    dl,0
  2140.     jmp    bdos
  2141. ;
  2142. l26c9:    jmp    nxcmd
  2143. ;
  2144. l26cc:    pop    bx
  2145.     pop    dx
  2146.     pop    cx
  2147.     ret
  2148. ;
  2149. ifasci:    cmp    al,0dh
  2150.     jnz    l26d5
  2151.     ret
  2152. ;
  2153. l26d5:    cmp    al,0ah
  2154.     jnz    l26da
  2155.     ret
  2156. ;
  2157. l26da:    or    al,al
  2158.     jnz    l26df
  2159.     ret
  2160. ;
  2161. l26df:    cmp    al,' '    ;20h
  2162.     jnb    l26e4
  2163.     ret
  2164. ;
  2165. l26e4:    cmp    al,7fh
  2166.     cmc
  2167.     ret
  2168. ;
  2169. bdos:    int    21h
  2170.     ret
  2171. ;
  2172. ;
  2173. ;
  2174. curofs    dw    0    ;active offset value
  2175. curpar    dw    0
  2176. ofsptr    dw    offset cofset    ;default code offset
  2177. deltof    dw    0    ;curofs-cofset for ctl tbl use
  2178. segsiz    dw    0    ;bytes in current segment
  2179. dmpstt    dw    00h    ;dump start addr initial
  2180. dmpend    dw    0100h    ;dump end addr initial
  2181. symtbl    dw    symbas    ;addr of symbol table start
  2182. symtp    dw    symbas    ;addr of sym tbl end+1
  2183. pcntr    dw    0h    ;prog counter for list etc.
  2184. hiload    dw    0    ;hi addr of loaded file
  2185. lastwd    dw    0100h
  2186. curadr    dw    0h
  2187. doctbl    dw    0d000h    ;comment table start addr
  2188. docend    dw    0d000h    ;comment table end addr
  2189. ctltbl    dw    ctlbas    ;mode table start addr
  2190. ctltop    dw    0    ;mode table end addr
  2191. fndpc    dw    0
  2192. fndadd    dw    0
  2193. dmpcnt    dw    0ffh
  2194. mcbbas    dw    0    ;memory control block
  2195. mcbsiz    dw    0    ;nr of paras
  2196. mcbext    db    0,0    ;mcbext and spare
  2197. ;
  2198. cstbl    db    '  '
  2199.     dw    0,0,0,0
  2200. cofset    dw    0h    ;default
  2201. ;
  2202. dstbl    db    '  '
  2203.     dw    0,0,0,0
  2204. dofset    dw    0h    ;default
  2205. ;
  2206. estbl    db    '  '
  2207.     dw    0,0,0,0
  2208. eofset    dw    0h    ;default
  2209. ;
  2210. sstbl    db    '  '
  2211.     dw    0,0,0,0
  2212. sofset    dw    0h    ;default
  2213. ;
  2214.     db    '  '
  2215.     dw    0,0,0,0
  2216.     dw    0
  2217. ;
  2218.     db    '  '
  2219.     dw    0,0,0,0
  2220.     dw    0
  2221. ;
  2222.     db    '  '
  2223.     dw    0,0,0,0
  2224.     dw    0
  2225. ;
  2226.     db    '  '
  2227.     dw    0,0,0,0
  2228.     dw    0
  2229.     db    0    ;table end flag
  2230. ;
  2231. segnam    dw    'SC'
  2232.     dw    'SD'
  2233.     dw    'SE'
  2234.     dw    'SS'
  2235.     dw    'X1'
  2236.     dw    'X2'
  2237.     dw    'X3'
  2238.     dw    'X4'
  2239. ;
  2240. fake_comtbl:
  2241.     db    1
  2242.     dw    0,10h,0,0
  2243.     db    2
  2244.     dw    0,10h,0,0
  2245.     db    3
  2246.     dw    0,10h,0,0
  2247.     db    4
  2248.     dw    0,0fffh,0,0
  2249.     dw    0,0,0,0
  2250. ;
  2251. lita86    db    'ASM'    ;literals for file types
  2252. litcmd    db    'COM'
  2253. litctl    db    'CTL'
  2254. litsym    db    'SMB'
  2255. litdoc    db    'DOC'
  2256. litall    db    'ALL'
  2257. ;
  2258. rplptr    dw    0    ;addr of replacement comment string
  2259. xcptr    dw    0
  2260. nxtctl    dw    0
  2261. insloc    dw    0
  2262. ofiptr    dw    0
  2263. segsho    db    'C->'    ;command prompt string
  2264. nrsegs    db    0    ;number of segments loaded
  2265. pfxcnt    db    0    ;prefix byte count
  2266. nlblfg    db    0    ;flag no label on instr
  2267. trmflg    db    -1    ;trim flag, label on instr line, dflt on
  2268. segval    db    0    ;segment prefix value
  2269. segmsk    db    0ch    ;curr segment test bits (code def.)
  2270. segflg    db    0    ;segment rqst in curr cmd
  2271. opdtyp    db    0    ;operand type (size & segment)
  2272. symtyp    db    0    ;symbol type (size & segment)
  2273. liscnt    db    22
  2274.     db    10
  2275. cntenb    db    1
  2276. replsw    db    0    ;flag for comment repl. instr
  2277. wfiflg    db    0
  2278. wrtflg    db    0
  2279. quiflg    db    0
  2280. sdflg    db    0
  2281. cinstr    db    0
  2282. strcnt    db    0
  2283. ecnt    db    0
  2284. adb    db    0
  2285. xcsw    db    0
  2286. pfflg    db    0
  2287. ascbld    db    0    ;next 2 items must stay together
  2288. sybflg    db    0    ;are accessed as a word
  2289. typndx    db    0,0,0
  2290. cmdbuf    db    80 dup (?)
  2291.     dw    128 dup (?)
  2292. stack    dw    ?
  2293. cfence    db    ?
  2294. ctlbas    dw    0600h    dup(?)    ;enough for 300 items
  2295. symbas    db    ?
  2296.  
  2297. code    ends
  2298.  
  2299.     end    start
  2300.  
  2301.  
  2302.